package com.yc.demo.QueryBooks;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "UpdateBookServlet", value = "/UpdateBookServlet.s")
public class UpdateBookServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        BookDao dao = new BookDao();
        String id = request.getParameter("id");
        String bookname = request.getParameter("bookname");
        String bookpress = request.getParameter("bookpress");
        String pressdate = request.getParameter("pressdate");
        String bookauthor = request.getParameter("bookauthor");
        String bookcount = request.getParameter("bookcount");
        try {
            dao.save(id,bookname,bookpress,pressdate,bookauthor,bookcount);
            response.getWriter().append("修改成功");
        }catch (Exception e){
            response.getWriter().append("修改失败");
        }

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
